import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'

// https://vite.dev/config/
export default defineConfig(({ mode }) => {
  const isProd = mode === 'production'
  return {
    plugins: [vue()],
    base: process.env.VITE_BASE_PATH || '/',
    resolve: {
      alias: {
        '@': resolve(__dirname, 'src'),
      },
    },
    build: {
      sourcemap: !isProd,
      reportCompressedSize: false,
    },
    esbuild: {
      // 日志策略由 logger 模块统一控制，这里不再丢弃 console
      drop: isProd ? ['debugger'] : [],
    },
    define: {
      __VUE_PROD_DEVTOOLS__: false,
    },
  }
})
